#ifndef __LOGIN_INFO_OP__H__   
#define __LOGIN_INFO_OP__H__

#include <interface/data_op/login_info.h>

namespace aot{ namespace data{
    
class login_info_impl : public ilogin_info
{
public:
    virtual ~login_info_impl(){;}
    login_info_impl()
    {
        user_id = &user_id_impl;
        user_def = &user_def_impl;
        email = &email_impl;
        mobile = &mobile_impl;
        ent_name = &ent_name_impl;
        ent_phone = &ent_phone_impl;
        oa_user = &oa_user_impl;
        password = &password_impl;
        create_time = &create_time_impl;
        last_login_time = &last_login_time_impl;

        login_type = 1;  
        auto_login = 0;
        face_image = 0;
        login_status = 0;
        save_info = 0;
        save_password = 0;
    }
public: 
    bool clone(ilogin_info** out) 
    {   
        login_info_impl* p = new login_info_impl();
        *out = p;
        return p->assign(this);
    }
    virtual  bool assign(const ilogin_info* in) 
    {
        if ( NULL == in )
            return false;

        login_info_impl* p = (login_info_impl*) in;
        *this = *p;

        user_id = &user_id_impl;
        user_def = &user_def_impl;
        email = &email_impl;
        mobile = &mobile_impl;
        ent_name = &ent_name_impl;
        ent_phone = &ent_phone_impl;
        oa_user = &oa_user_impl;
        password = &password_impl;
        create_time = &create_time_impl;
        last_login_time = &last_login_time_impl; 
        return true;
    }
public:
    aot::tt::str_impl user_id_impl;
    aot::tt::str_impl user_def_impl;
    aot::tt::str_impl email_impl;
    aot::tt::str_impl mobile_impl;
    aot::tt::str_impl ent_name_impl;
    aot::tt::str_impl ent_phone_impl;
    aot::tt::str_impl oa_user_impl;
    aot::tt::str_impl password_impl;
    aot::tt::str_impl create_time_impl;
    aot::tt::str_impl last_login_time_impl;
   
};

class login_info_op_impl : public aot::data::ilogin_info_op
{
public:
    login_info_op_impl(void);
public:
    virtual ~login_info_op_impl(void);
public:    
    virtual bool del_all();
	virtual bool is_user_save_pwd(const char* user_id);
	virtual bool save_user_pwd(const char* user_id, const char* pwd, const char* cur_datetime, const char* nick_name);
	virtual bool save_user_pwd_cancel (const char* user_id);
    virtual bool insert_latest_login_info(ilogin_info* p);
    virtual bool del_latest_login_info(const char* user_id);
    virtual bool get_latest_login_info(const char* user_id, ilogin_info** out);
    virtual bool get_latest_login_info(const char* user_id, ilogin_info* out);
	virtual bool get_latest_login_info(ilogin_info** out);
    virtual bool get_latest_login_info_list(ilogin_info_list** out);
    virtual bool save_latest_login_info_list(ilogin_info_list* in);
	virtual bool get_latest_login_info_list(int login_type, ilogin_info_list** out);
	virtual bool get_login_info(int login_type, const char* value, ilogin_info** out);

};

}} /* end namespace aot/data*/

#endif // __LOGIN_INFO_OP__H__
